package com.sharemarking.wa.platform.utils;

import com.alipay.api.AlipayClient;
import com.alipay.api.DefaultAlipayClient;
import com.sharemarking.wa.platform.properties.AliPayProperties;

public class AlipayClientFactory {

	private static AlipayClient client;

	public AlipayClientFactory() {
		
	}

	public static AlipayClient produce(AliPayProperties properties) {
		if (client == null) {
			client = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do", properties.getAppId(), properties.getPrivateKey(), "JSON",
					"utf-8", properties.getPublicKey(), "RSA2"); // 获得初始化的AlipayClient
		}
		return client;
	}
}
